<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>食堂餐券系统 - 后台管理</title>
    <!-- 引入Bootstrap样式 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
    <!-- 引入Font Awesome图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <!-- 引入Chart.js库 -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.min.js"></script>
    <!-- 自定义样式 -->
    <link rel="stylesheet" href="admin.css">
    
    <!-- 添加内联样式 -->
    <style>
        /* 上传占位符样式 */
        .upload-placeholder {
            width: 40px;
            height: 40px;
            background-color: #f8f9fa;
            border: 1px dashed #ced4da;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6c757d;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .upload-placeholder:hover {
            background-color: #e9ecef;
            color: #495057;
        }
        
        /* 新添加行的动画效果 */
        .new-dish-row, .new-product-row {
            animation: fadeIn 0.5s ease;
            background-color: #f8f9fa;
        }
        
        /* 输入框样缩小适应表格 */
        .new-dish-row .form-control, .new-product-row .form-control,
        .new-dish-row .form-select, .new-product-row .form-select {
            height: 30px;
            padding: 0.25rem 0.5rem;
            font-size: 0.875rem;
        }
        
        /* 添加和删除按钮行高亮 */
        #dish-action-row, #product-action-row {
            background-color: #f8f9fa;
        }
        
        #dish-action-row td, #product-action-row td {
            padding: 0.5rem;
        }
        
        /* 淡入动画 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body>
    <div class="admin-layout">
        <!-- 侧边栏 -->
        <div class="sidebar" id="sidebar">
            <div class="sidebar-header">
                <h3>餐券系统管理</h3>
                <button class="btn toggle-btn" id="toggle-sidebar">
                    <i class="fas fa-bars"></i>
                </button>
            </div>
            <div class="sidebar-menu">
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link active" href="#user-management" data-bs-toggle="tab">
                            <i class="fas fa-users"></i> 用户管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#ticket-management" data-bs-toggle="tab">
                            <i class="fas fa-ticket-alt"></i> 特色小吃菜品管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#product-management" data-bs-toggle="tab">
                            <i class="fas fa-shopping-cart"></i> 餐券商品管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#exchange-records" data-bs-toggle="tab">
                            <i class="fas fa-exchange-alt"></i> 兑换记录
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#vote-management" data-bs-toggle="tab">
                            <i class="fas fa-vote-yea"></i> 投票管理
                        </a>
                    </li>
                </ul>
            </div>
        </div>

        <!-- 主内容区 -->
        <div class="main-content">
            <!-- 顶部导航 -->
            <div class="top-bar">
                <div class="search-box">
                    <input type="text" class="form-control" placeholder="搜索...">
                    <button class="btn"><i class="fas fa-search"></i></button>
                </div>
                <div class="top-right">
                    <div class="notifications">
                        <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">
                            <i class="fas fa-bell"></i>
                            <span class="badge bg-danger">3</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-end">
                            <h6 class="dropdown-header">通知</h6>
                            <a class="dropdown-item" href="#">
                                <div class="notification-item">
                                    <div class="icon bg-primary"><i class="fas fa-user-plus"></i></div>
                                    <div class="content">
                                        <p>新增10名员工账号</p>
                                        <small>2分钟前</small>
                                    </div>
                                </div>
                            </a>
                            <a class="dropdown-item" href="#">
                                <div class="notification-item">
                                    <div class="icon bg-success"><i class="fas fa-exchange-alt"></i></div>
                                    <div class="content">
                                        <p>今日已完成15笔兑换</p>
                                        <small>1小时前</small>
                                    </div>
                                </div>
                            </a>
                            <a class="dropdown-item" href="#">
                                <div class="notification-item">
                                    <div class="icon bg-warning"><i class="fas fa-exclamation-triangle"></i></div>
                                    <div class="content">
                                        <p>系统餐券余额不足</p>
                                        <small>5小时前</small>
                                    </div>
                                </div>
                            </a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item text-center" href="#">查看全部</a>
                        </div>
                    </div>
                    <div class="user-profile">
                        <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">
                            <img src="https://via.placeholder.com/36" alt="用户头像" class="avatar">
                            <span class="username">管理员</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-end">
                            <a class="dropdown-item" href="#"><i class="fas fa-user"></i> 个人资料</a>
                            <a class="dropdown-item" href="#"><i class="fas fa-cog"></i> 账户设置</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 内容区域 -->
            <div class="content">
                <div class="tab-content">
                    <!-- 控制面板已移除 -->
                    
                    <!-- 用户管理 Tab -->
                    <div class="tab-pane fade show active" id="user-management">
                        <div class="page-header">
                            <h2>用户管理</h2>
                            <p class="text-muted">管理系统用户和员工账户</p>
                        </div>
                        
                        <!-- 用户管理内容将在这里 -->
                        <div class="card">
                            <div class="card-header">
                                <h5 class="card-title">用户列表</h5>
                                <div class="card-actions">
                                    <button class="btn btn-primary"><i class="fas fa-plus"></i> 添加用户</button>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="d-flex justify-content-between mb-3">
                                    <div class="search-field">
                                        <input type="text" class="form-control" placeholder="搜索用户...">
                                    </div>
                                    <div class="filter-options">
                                        <select class="form-select">
                                            <option>所有部门</option>
                                            <option>技术部</option>
                                            <option>市场部</option>
                                            <option>人事部</option>
                                            <option>财务部</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="table-responsive">
                                    <table class="table table-hover">
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>姓名</th>
                                                <th>部门</th>
                                                <th>工号</th>
                                                <th>餐券余额</th>
                                                <th>角色</th>
                                                <th>状态</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>1001</td>
                                                <td>张三</td>
                                                <td>技术部</td>
                                                <td>T2023001</td>
                                                <td>12.00</td>
                                                <td><span class="badge bg-danger">管理员</span></td>
                                                <td><span class="badge bg-success">正常</span></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>1002</td>
                                                <td>李四</td>
                                                <td>市场部</td>
                                                <td>M2023002</td>
                                                <td>8.00</td>
                                                <td><span class="badge bg-secondary">普通用户</span></td>
                                                <td><span class="badge bg-success">正常</span></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>1003</td>
                                                <td>王五</td>
                                                <td>人事部</td>
                                                <td>H2023003</td>
                                                <td>15.00</td>
                                                <td><span class="badge bg-secondary">普通用户</span></td>
                                                <td><span class="badge bg-success">正常</span></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>1004</td>
                                                <td>赵六</td>
                                                <td>财务部</td>
                                                <td>F2023004</td>
                                                <td>9.50</td>
                                                <td><span class="badge bg-secondary">普通用户</span></td>
                                                <td><span class="badge bg-warning">请假中</span></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>1005</td>
                                                <td>孙七</td>
                                                <td>技术部</td>
                                                <td>T2023005</td>
                                                <td>20.00</td>
                                                <td><span class="badge bg-secondary">普通用户</span></td>
                                                <td><span class="badge bg-danger">离职</span></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                
                                <nav aria-label="Page navigation">
                                    <ul class="pagination justify-content-center">
                                        <li class="page-item disabled">
                                            <a class="page-link" href="#" tabindex="-1">上一页</a>
                                        </li>
                                        <li class="page-item active"><a class="page-link" href="#">1</a></li>
                                        <li class="page-item"><a class="page-link" href="#">2</a></li>
                                        <li class="page-item"><a class="page-link" href="#">3</a></li>
                                        <li class="page-item">
                                            <a class="page-link" href="#">下一页</a>
                                        </li>
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 其他Tab内容将在此添加 -->
                    <div class="tab-pane fade" id="ticket-management">
                        <div class="page-header">
                            <h2>特色小吃菜品管理</h2>
                            <p class="text-muted">管理特色小吃和主食菜品</p>
                        </div>
                        <!-- 特色小吃和主食菜品管理内容 -->
                        <div class="row">
                            <div class="col-md-12">
                                <div class="card">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <h5 class="card-title mb-0">菜品列表</h5>
                                        <div class="d-flex">
                                            <div class="me-2">
                                                <select class="form-select form-select-sm" id="dish-filter">
                                                    <option value="all">所有菜品</option>
                                                    <option value="snack">特色小吃</option>
                                                    <option value="staple">主食</option>
                                                </select>
                                            </div>
                                            <div class="input-group input-group-sm">
                                                <input type="text" class="form-control" placeholder="搜索菜品..." id="dish-search">
                                                <button class="btn btn-outline-secondary" type="button">
                                                    <i class="fas fa-search"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="card-body p-0">
                                        <div class="table-responsive">
                                            <table class="table table-hover align-middle mb-0">
                                                <thead>
                                                    <tr>
                                                        <th width="60">图片</th>
                                                        <th>菜品名称</th>
                                                        <th>菜品类型</th>
                                                        <th>价格</th>
                                                        <th>投票状态</th>
                                                        <th>投票进度</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="dish-table-body">
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="红烧肉" class="img-thumbnail">
                                                        </td>
                                                        <td>红烧肉</td>
                                                        <td><span class="badge bg-info">特色小吃</span></td>
                                                        <td>¥15</td>
                                                        <td><span class="badge bg-success">可投票</span></td>
                                                        <td>
                                                            <div class="progress" style="height: 6px; width: 80px;">
                                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 85%"></div>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="水煮鱼" class="img-thumbnail">
                                                        </td>
                                                        <td>水煮鱼</td>
                                                        <td><span class="badge bg-info">特色小吃</span></td>
                                                        <td>¥20</td>
                                                        <td><span class="badge bg-success">可投票</span></td>
                                                        <td>
                                                            <div class="progress" style="height: 6px; width: 80px;">
                                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 75%"></div>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="米饭" class="img-thumbnail">
                                                        </td>
                                                        <td>米饭</td>
                                                        <td><span class="badge bg-primary">主食</span></td>
                                                        <td>¥2</td>
                                                        <td><span class="badge bg-secondary">不可投票</span></td>
                                                        <td>
                                                            <div class="progress" style="height: 6px; width: 80px;">
                                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 100%"></div>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="炸酱面" class="img-thumbnail">
                                                        </td>
                                                        <td>炸酱面</td>
                                                        <td><span class="badge bg-info">特色小吃</span></td>
                                                        <td>¥12</td>
                                                        <td><span class="badge bg-success">可投票</span></td>
                                                        <td>
                                                            <div class="progress" style="height: 6px; width: 80px;">
                                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 60%"></div>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="麻婆豆腐" class="img-thumbnail">
                                                        </td>
                                                        <td>麻婆豆腐</td>
                                                        <td><span class="badge bg-info">特色小吃</span></td>
                                                        <td>¥10</td>
                                                        <td><span class="badge bg-success">可投票</span></td>
                                                        <td>
                                                            <div class="progress" style="height: 6px; width: 80px;">
                                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 40%"></div>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <!-- 新增和删除按钮行 -->
                                                    <tr id="dish-action-row">
                                                        <td colspan="8" class="text-center">
                                                            <button class="btn btn-success btn-sm me-2" id="add-dish-row">
                                                                <i class="fas fa-plus"></i> 添加菜品
                                                            </button>
                                                            <button class="btn btn-danger btn-sm" id="remove-dish-row">
                                                                <i class="fas fa-minus"></i> 移除菜品
                                                            </button>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <nav aria-label="Page navigation">
                                            <ul class="pagination justify-content-center mb-0">
                                                <li class="page-item disabled">
                                                    <a class="page-link" href="#" tabindex="-1">上一页</a>
                                                </li>
                                                <li class="page-item active"><a class="page-link" href="#">1</a></li>
                                                <li class="page-item"><a class="page-link" href="#">2</a></li>
                                                <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                <li class="page-item">
                                                    <a class="page-link" href="#">下一页</a>
                                                </li>
                                            </ul>
                                        </nav>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="tab-pane fade" id="product-management">
                        <div class="page-header">
                            <h2>餐券商品管理</h2>
                            <p class="text-muted">管理可用餐券兑换的商品</p>
                        </div>
                        <!-- 商品管理内容将在这里 -->
                        <div class="row">
                            <div class="col-md-12">
                                <div class="card">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <h5 class="card-title mb-0">商品列表</h5>
                                        <div class="d-flex">
                                            <div class="me-2">
                                                <select class="form-select form-select-sm" id="product-filter">
                                                    <option value="all">所有商品</option>
                                                    <option value="physical">实物商品</option>
                                                    <option value="food">餐厅菜品</option>
                                                </select>
                                            </div>
                                            <div class="input-group input-group-sm">
                                                <input type="text" class="form-control" placeholder="搜索商品..." id="product-search">
                                                <button class="btn btn-outline-secondary" type="button">
                                                    <i class="fas fa-search"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="card-body p-0">
                                        <div class="table-responsive">
                                            <table class="table table-hover align-middle mb-0">
                                                <thead>
                                                    <tr>
                                                        <th width="60">图片</th>
                                                        <th>商品名称</th>
                                                        <th>类型</th>
                                                        <th>分类</th>
                                                        <th>价格</th>
                                                        <th>库存</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="product-table-body">
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="大米" class="img-thumbnail">
                                                        </td>
                                                        <td>东北大米</td>
                                                        <td><span class="badge bg-primary">实物商品</span></td>
                                                        <td>大米</td>
                                                        <td>1.0</td>
                                                        <td>200</td>
                                                        <td><span class="badge bg-success">已上架</span></td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="面条" class="img-thumbnail">
                                                        </td>
                                                        <td>五谷杂粮面</td>
                                                        <td><span class="badge bg-primary">实物商品</span></td>
                                                        <td>面条</td>
                                                        <td>2.0</td>
                                                        <td>150</td>
                                                        <td><span class="badge bg-success">已上架</span></td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="食用油" class="img-thumbnail">
                                                        </td>
                                                        <td>金龙鱼调和油</td>
                                                        <td><span class="badge bg-primary">实物商品</span></td>
                                                        <td>食用油</td>
                                                        <td>3.0</td>
                                                        <td>80</td>
                                                        <td><span class="badge bg-success">已上架</span></td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="红烧肉" class="img-thumbnail">
                                                        </td>
                                                        <td>红烧肉</td>
                                                        <td><span class="badge bg-info">餐厅菜品</span></td>
                                                        <td>肉类</td>
                                                        <td>1.5</td>
                                                        <td>--</td>
                                                        <td><span class="badge bg-success">已上架</span></td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <img src="https://via.placeholder.com/40" alt="水煮鱼" class="img-thumbnail">
                                                        </td>
                                                        <td>水煮鱼</td>
                                                        <td><span class="badge bg-info">餐厅菜品</span></td>
                                                        <td>特色小吃</td>
                                                        <td>2.0</td>
                                                        <td>--</td>
                                                        <td><span class="badge bg-warning">待上架</span></td>
                                                        <td>
                                                            <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                                            <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                                                        </td>
                                                    </tr>
                                                    <!-- 新增和删除按钮行 -->
                                                    <tr id="product-action-row">
                                                        <td colspan="8" class="text-center">
                                                            <button class="btn btn-success btn-sm me-2" id="add-product-row">
                                                                <i class="fas fa-plus"></i> 添加商品
                                                            </button>
                                                            <button class="btn btn-danger btn-sm" id="remove-product-row">
                                                                <i class="fas fa-minus"></i> 移除商品
                                                            </button>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <nav aria-label="Page navigation">
                                            <ul class="pagination justify-content-center mb-0">
                                                <li class="page-item disabled">
                                                    <a class="page-link" href="#" tabindex="-1">上一页</a>
                                                </li>
                                                <li class="page-item active"><a class="page-link" href="#">1</a></li>
                                                <li class="page-item"><a class="page-link" href="#">2</a></li>
                                                <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                <li class="page-item">
                                                    <a class="page-link" href="#">下一页</a>
                                                </li>
                                            </ul>
                                        </nav>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 商品编辑模态框 -->
                        <div class="modal fade" id="edit-product-modal" tabindex="-1" aria-labelledby="edit-product-modal-label" aria-hidden="true">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="edit-product-modal-label">编辑商品</h5>
                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <div class="modal-body">
                                        <form id="edit-product-form">
                                            <div class="row">
                                                <div class="col-md-8">
                                                    <div class="mb-3">
                                                        <label for="edit-product-name" class="form-label">商品名称</label>
                                                        <input type="text" class="form-control" id="edit-product-name" required>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <div class="mb-3">
                                                                <label for="edit-product-type" class="form-label">商品类型</label>
                                                                <select class="form-select" id="edit-product-type" required>
                                                                    <option value="physical">实物商品</option>
                                                                    <option value="food">餐厅菜品</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="mb-3">
                                                                <label for="edit-product-category" class="form-label">分类</label>
                                                                <select class="form-select" id="edit-product-category" required>
                                                                    <option value="staple">主食</option>
                                                                    <option value="meat">肉类</option>
                                                                    <option value="vegetable">蔬菜</option>
                                                                    <option value="snack">特色小吃</option>
                                                                    <option value="grocery">日用品</option>
                                                                    <option value="oil">食用油</option>
                                                                    <option value="rice">大米</option>
                                                                    <option value="other">其他</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <div class="mb-3">
                                                                <label for="edit-product-price" class="form-label">价格（餐券）</label>
                                                                <input type="number" class="form-control" id="edit-product-price" min="0" step="0.5" required>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="mb-3">
                                                                <label for="edit-product-stock" class="form-label">库存数量</label>
                                                                <input type="number" class="form-control" id="edit-product-stock" min="0" required>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="mb-3">
                                                        <label for="edit-product-description" class="form-label">商品描述</label>
                                                        <textarea class="form-control" id="edit-product-description" rows="4"></textarea>
                                                    </div>
                                                    <div class="mb-3">
                                                        <div class="form-check">
                                                            <input class="form-check-input" type="checkbox" id="edit-product-active" checked>
                                                            <label class="form-check-label" for="edit-product-active">
                                                                商品上架
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <div class="mb-3">
                                                        <label for="edit-product-image" class="form-label">商品图片</label>
                                                        <input type="file" class="form-control" id="edit-product-image" accept="image/*">
                                                    </div>
                                                    <div class="edit-image-preview">
                                                        <img src="https://via.placeholder.com/200" alt="商品图片预览" class="img-fluid rounded">
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                                        <button type="button" class="btn btn-primary" id="save-edit-product">保存修改</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 删除确认模态框 -->
                        <div class="modal fade" id="confirm-delete-modal" tabindex="-1" aria-hidden="true">
                            <div class="modal-dialog modal-dialog-centered">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title">确认删除</h5>
                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <div class="modal-body">
                                        <p>您确定要删除这个商品吗？此操作无法撤销。</p>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                                        <button type="button" class="btn btn-danger" id="confirm-delete-btn">确认删除</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="tab-pane fade" id="exchange-records">
                        <div class="page-header">
                            <h2>兑换记录</h2>
                            <p class="text-muted">查看和管理餐券兑换记录</p>
                        </div>
                        <!-- 兑换记录内容 -->
                        <div class="card">
                            <div class="card-header d-flex justify-content-between align-items-center">
                                <h5 class="card-title mb-0">兑换记录列表</h5>
                                <div class="d-flex">
                                    <div class="input-group me-2">
                                        <input type="text" class="form-control" placeholder="搜索记录..." id="exchange-search">
                                        <button class="btn btn-outline-secondary" type="button">
                                            <i class="fas fa-search"></i>
                                        </button>
                                    </div>
                                    <div class="dropdown">
                                        <button class="btn btn-outline-primary dropdown-toggle" type="button" id="exportDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                                            导出
                                        </button>
                                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="exportDropdown">
                                            <li><a class="dropdown-item" href="#"><i class="fas fa-file-excel me-2"></i>导出为Excel</a></li>
                                            <li><a class="dropdown-item" href="#"><i class="fas fa-file-pdf me-2"></i>导出为PDF</a></li>
                                            <li><a class="dropdown-item" href="#"><i class="fas fa-print me-2"></i>打印记录</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="mb-3">
                                    <div class="row g-3">
                                        <div class="col-md-3">
                                            <label for="exchange-date-range" class="form-label">日期范围</label>
                                            <select class="form-select" id="exchange-date-range">
                                                <option value="today">今天</option>
                                                <option value="yesterday">昨天</option>
                                                <option value="this-week" selected>本周</option>
                                                <option value="last-week">上周</option>
                                                <option value="this-month">本月</option>
                                                <option value="last-month">上月</option>
                                                <option value="custom">自定义范围</option>
                                            </select>
                                        </div>
                                        <div class="col-md-3">
                                            <label for="exchange-status" class="form-label">兑换状态</label>
                                            <select class="form-select" id="exchange-status">
                                                <option value="all" selected>全部状态</option>
                                                <option value="completed">已完成</option>
                                                <option value="pending">待处理</option>
                                                <option value="canceled">已取消</option>
                                                <option value="refunded">已退款</option>
                                            </select>
                                        </div>
                                        <div class="col-md-3">
                                            <label for="exchange-department" class="form-label">部门</label>
                                            <select class="form-select" id="exchange-department">
                                                <option value="all" selected>全部部门</option>
                                                <option value="tech">技术部</option>
                                                <option value="market">市场部</option>
                                                <option value="hr">人事部</option>
                                                <option value="finance">财务部</option>
                                            </select>
                                        </div>
                                        <div class="col-md-3">
                                            <label for="exchange-product" class="form-label">商品类型</label>
                                            <select class="form-select" id="exchange-product">
                                                <option value="all" selected>全部商品</option>
                                                <option value="food">食品类</option>
                                                <option value="daily">日用品</option>
                                                <option value="grocery">杂货</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="row mb-4">
                                    <div class="col-md-3">
                                        <div class="stats-card bg-primary text-white">
                                            <div class="stats-info">
                                                <h5>总兑换数</h5>
                                                <h3>1,286</h3>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="stats-card bg-success text-white">
                                            <div class="stats-info">
                                                <h5>已完成</h5>
                                                <h3>1,235</h3>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="stats-card bg-warning text-white">
                                            <div class="stats-info">
                                                <h5>待处理</h5>
                                                <h3>46</h3>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="stats-card bg-danger text-white">
                                            <div class="stats-info">
                                                <h5>餐券消耗</h5>
                                                <h3>3,520</h3>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="table-responsive">
                                    <table class="table table-hover" id="exchange-table">
                                        <thead>
                                            <tr>
                                                <th>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox" id="select-all-exchanges">
                                                    </div>
                                                </th>
                                                <th>ID</th>
                                                <th>用户</th>
                                                <th>部门</th>
                                                <th>商品</th>
                                                <th>餐券</th>
                                                <th>兑换时间</th>
                                                <th>状态</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox">
                                                    </div>
                                                </td>
                                                <td><a href="#" class="text-primary">#EX1243</a></td>
                                                <td>张三</td>
                                                <td>技术部</td>
                                                <td>
                                                    <div class="d-flex align-items-center">
                                                        <img src="https://via.placeholder.com/32" class="rounded me-2" alt="大米">
                                                        <span>东北大米</span>
                                                    </div>
                                                </td>
                                                <td>2.00</td>
                                                <td>2023-05-10 14:23</td>
                                                <td><span class="badge bg-success">已完成</span></td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                                                            操作
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-eye me-2"></i>查看详情</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-print me-2"></i>打印凭证</a></li>
                                                            <li><hr class="dropdown-divider"></li>
                                                            <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除记录</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox">
                                                    </div>
                                                </td>
                                                <td><a href="#" class="text-primary">#EX1242</a></td>
                                                <td>李四</td>
                                                <td>市场部</td>
                                                <td>
                                                    <div class="d-flex align-items-center">
                                                        <img src="https://via.placeholder.com/32" class="rounded me-2" alt="食用油">
                                                        <span>金龙鱼食用油</span>
                                                    </div>
                                                </td>
                                                <td>3.00</td>
                                                <td>2023-05-10 13:45</td>
                                                <td><span class="badge bg-success">已完成</span></td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                                                            操作
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-eye me-2"></i>查看详情</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-print me-2"></i>打印凭证</a></li>
                                                            <li><hr class="dropdown-divider"></li>
                                                            <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除记录</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox">
                                                    </div>
                                                </td>
                                                <td><a href="#" class="text-primary">#EX1241</a></td>
                                                <td>王五</td>
                                                <td>人事部</td>
                                                <td>
                                                    <div class="d-flex align-items-center">
                                                        <img src="https://via.placeholder.com/32" class="rounded me-2" alt="面条">
                                                        <span>五谷杂粮面</span>
                                                    </div>
                                                </td>
                                                <td>6.00</td>
                                                <td>2023-05-10 11:32</td>
                                                <td><span class="badge bg-success">已完成</span></td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                                                            操作
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-eye me-2"></i>查看详情</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-print me-2"></i>打印凭证</a></li>
                                                            <li><hr class="dropdown-divider"></li>
                                                            <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除记录</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox">
                                                    </div>
                                                </td>
                                                <td><a href="#" class="text-primary">#EX1240</a></td>
                                                <td>赵六</td>
                                                <td>财务部</td>
                                                <td>
                                                    <div class="d-flex align-items-center">
                                                        <img src="https://via.placeholder.com/32" class="rounded me-2" alt="大米">
                                                        <span>东北大米</span>
                                                    </div>
                                                </td>
                                                <td>1.00</td>
                                                <td>2023-05-10 10:17</td>
                                                <td><span class="badge bg-warning">待处理</span></td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                                                            操作
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-eye me-2"></i>查看详情</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-check-circle me-2"></i>标记完成</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-times-circle me-2"></i>取消兑换</a></li>
                                                            <li><hr class="dropdown-divider"></li>
                                                            <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除记录</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr class="table-light">
                                                <td>
                                                    <div class="form-check">
                                                        <input class="form-check-input" type="checkbox">
                                                    </div>
                                                </td>
                                                <td><a href="#" class="text-primary">#EX1239</a></td>
                                                <td>孙七</td>
                                                <td>技术部</td>
                                                <td>
                                                    <div class="d-flex align-items-center">
                                                        <img src="https://via.placeholder.com/32" class="rounded me-2" alt="食用油">
                                                        <span>金龙鱼食用油</span>
                                                    </div>
                                                </td>
                                                <td>6.00</td>
                                                <td>2023-05-10 09:25</td>
                                                <td><span class="badge bg-secondary">已取消</span></td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                                                            操作
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-eye me-2"></i>查看详情</a></li>
                                                            <li><a class="dropdown-item" href="#"><i class="fas fa-print me-2"></i>打印凭证</a></li>
                                                            <li><hr class="dropdown-divider"></li>
                                                            <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除记录</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                
                                <div class="d-flex justify-content-between align-items-center mt-4">
                                    <div class="bulk-actions">
                                        <button class="btn btn-outline-primary me-2" disabled id="bulk-action-btn">
                                            <i class="fas fa-cog me-1"></i> 批量操作
                                        </button>
                                        <div class="btn-group d-none" id="bulk-action-options">
                                            <button class="btn btn-outline-success"><i class="fas fa-check-circle"></i> 标记完成</button>
                                            <button class="btn btn-outline-warning"><i class="fas fa-times-circle"></i> 取消兑换</button>
                                            <button class="btn btn-outline-danger"><i class="fas fa-trash-alt"></i> 删除记录</button>
                                        </div>
                                    </div>
                                    <nav aria-label="Page navigation">
                                        <ul class="pagination justify-content-center m-0">
                                            <li class="page-item disabled">
                                                <a class="page-link" href="#" tabindex="-1">上一页</a>
                                            </li>
                                            <li class="page-item active"><a class="page-link" href="#">1</a></li>
                                            <li class="page-item"><a class="page-link" href="#">2</a></li>
                                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                                            <li class="page-item">
                                                <a class="page-link" href="#">下一页</a>
                                            </li>
                                        </ul>
                                    </nav>
                                    <div class="page-info">
                                        显示 1-5 条，共 42 条记录
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 记录详情模态框 -->
                        <div class="modal fade" id="exchange-details-modal" tabindex="-1" aria-labelledby="exchange-details-label" aria-hidden="true">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="exchange-details-label">兑换记录详情</h5>
                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <div class="modal-body">
                                        <div class="row mb-3">
                                            <div class="col-md-6">
                                                <h6>兑换信息</h6>
                                                <table class="table table-sm">
                                                    <tr>
                                                        <th width="120">订单编号：</th>
                                                        <td>#EX1243</td>
                                                    </tr>
                                                    <tr>
                                                        <th>兑换时间：</th>
                                                        <td>2023-05-10 14:23</td>
                                                    </tr>
                                                    <tr>
                                                        <th>订单状态：</th>
                                                        <td><span class="badge bg-success">已完成</span></td>
                                                    </tr>
                                                    <tr>
                                                        <th>处理人员：</th>
                                                        <td>王管理</td>
                                                    </tr>
                                                    <tr>
                                                        <th>备注：</th>
                                                        <td>用户当面兑换</td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="col-md-6">
                                                <h6>用户信息</h6>
                                                <table class="table table-sm">
                                                    <tr>
                                                        <th width="120">用户姓名：</th>
                                                        <td>张三</td>
                                                    </tr>
                                                    <tr>
                                                        <th>工号：</th>
                                                        <td>T2023001</td>
                                                    </tr>
                                                    <tr>
                                                        <th>部门：</th>
                                                        <td>技术部</td>
                                                    </tr>
                                                    <tr>
                                                        <th>餐券余额：</th>
                                                        <td>10.0</td>
                                                    </tr>
                                                    <tr>
                                                        <th>状态：</th>
                                                        <td><span class="badge bg-success">正常</span></td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                        <div class="exchange-items">
                                            <h6>兑换商品</h6>
                                            <table class="table">
                                                <thead>
                                                    <tr>
                                                        <th>商品</th>
                                                        <th>餐券价格</th>
                                                        <th>小计</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/40" class="rounded me-2" alt="大米">
                                                                <div>
                                                                    <div>东北大米</div>
                                                                    <small class="text-muted">实物商品 / 大米</small>
                                                                </div>
                                                            </div>
                                                        </td>
                                                        <td>1.00</td>
                                                        <td>2.00</td>
                                                    </tr>
                                                </tbody>
                                                <tfoot>
                                                    <tr>
                                                        <th colspan="2" class="text-end">总计：</th>
                                                        <th>2.00</th>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                        <div class="exchange-timeline mt-4">
                                            <h6>兑换流程</h6>
                                            <ul class="timeline">
                                                <li class="timeline-item">
                                                    <div class="timeline-badge bg-success"><i class="fas fa-check"></i></div>
                                                    <div class="timeline-content">
                                                        <h6 class="mb-0">兑换完成</h6>
                                                        <small class="text-muted">2023-05-10 14:25</small>
                                                        <p>用户已领取商品</p>
                                                    </div>
                                                </li>
                                                <li class="timeline-item">
                                                    <div class="timeline-badge bg-info"><i class="fas fa-cog"></i></div>
                                                    <div class="timeline-content">
                                                        <h6 class="mb-0">订单处理中</h6>
                                                        <small class="text-muted">2023-05-10 14:24</small>
                                                        <p>管理员正在处理订单</p>
                                                    </div>
                                                </li>
                                                <li class="timeline-item">
                                                    <div class="timeline-badge bg-primary"><i class="fas fa-plus"></i></div>
                                                    <div class="timeline-content">
                                                        <h6 class="mb-0">创建兑换订单</h6>
                                                        <small class="text-muted">2023-05-10 14:23</small>
                                                        <p>用户创建了新的兑换订单</p>
                                                    </div>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                                        <button type="button" class="btn btn-outline-secondary"><i class="fas fa-print me-1"></i> 打印凭证</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 投票管理 Tab -->
                    <div class="tab-pane fade" id="vote-management">
                        <div class="page-header">
                            <h2>投票管理</h2>
                            <p class="text-muted">管理餐品投票活动</p>
                        </div>
                        
                        <!-- 投票管理内容 -->
                        <div class="row mb-4">
                            <div class="col-lg-6">
                                <!-- 特色小吃投票列表 -->
                                <div class="card mb-4">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <h5 class="card-title mb-0">特色小吃投票列表</h5>
                                        <div class="d-flex">
                                            <div class="dropdown">
                                                <button class="btn btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                                    导出
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-end">
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-file-excel me-2"></i>导出为Excel</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-file-pdf me-2"></i>导出为PDF</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table table-hover align-middle">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>菜品</th>
                                                        <th>开始时间</th>
                                                        <th>结束时间</th>
                                                        <th>状态</th>
                                                        <th>参与人数</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>#V1001</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="红烧肉">
                                                                <div>红烧肉</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-05-01</td>
                                                        <td>2023-05-07</td>
                                                        <td><span class="badge bg-success">进行中</span></td>
                                                        <td>86</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn" data-vote-id="1001"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn" data-vote-id="1001"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn" data-vote-id="1001"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>#V999</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="水煮鱼">
                                                                <div>水煮鱼</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-04-01</td>
                                                        <td>2023-04-07</td>
                                                        <td><span class="badge bg-secondary">已结束</span></td>
                                                        <td>95</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn" data-vote-id="999"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn" data-vote-id="999"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn" data-vote-id="999"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>#V997</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="麻婆豆腐">
                                                                <div>麻婆豆腐</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-03-01</td>
                                                        <td>2023-03-07</td>
                                                        <td><span class="badge bg-secondary">已结束</span></td>
                                                        <td>78</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <button class="btn btn-success w-100" id="add-snack-vote">
                                            <i class="fas fa-plus"></i> 添加特色小吃投票
                                        </button>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="col-lg-6">
                                <!-- 主食投票列表 -->
                                <div class="card mb-4">
                                    <div class="card-header d-flex justify-content-between align-items-center">
                                        <h5 class="card-title mb-0">主食投票列表</h5>
                                        <div class="d-flex">
                                            <div class="dropdown">
                                                <button class="btn btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                                    导出
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-end">
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-file-excel me-2"></i>导出为Excel</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-file-pdf me-2"></i>导出为PDF</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table table-hover align-middle">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>菜品</th>
                                                        <th>开始时间</th>
                                                        <th>结束时间</th>
                                                        <th>状态</th>
                                                        <th>参与人数</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>#V1000</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="炸酱面">
                                                                <div>炸酱面</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-04-15</td>
                                                        <td>2023-04-30</td>
                                                        <td><span class="badge bg-secondary">已结束</span></td>
                                                        <td>124</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn" data-vote-id="1000"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn" data-vote-id="1000"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn" data-vote-id="1000"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>#V998</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="米饭">
                                                                <div>米饭</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-03-15</td>
                                                        <td>2023-03-30</td>
                                                        <td><span class="badge bg-secondary">已结束</span></td>
                                                        <td>142</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>#V996</td>
                                                        <td>
                                                            <div class="d-flex align-items-center">
                                                                <img src="https://via.placeholder.com/32" class="rounded me-2" alt="拉面">
                                                                <div>拉面</div>
                                                            </div>
                                                        </td>
                                                        <td>2023-02-15</td>
                                                        <td>2023-02-28</td>
                                                        <td><span class="badge bg-secondary">已结束</span></td>
                                                        <td>105</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <button class="btn btn-sm btn-outline-primary view-vote-btn"><i class="fas fa-eye"></i></button>
                                                                <button class="btn btn-sm btn-outline-warning edit-vote-btn"><i class="fas fa-edit"></i></button>
                                                                <button class="btn btn-sm btn-outline-danger delete-vote-btn"><i class="fas fa-trash-alt"></i></button>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <button class="btn btn-success w-100" id="add-staple-vote">
                                            <i class="fas fa-plus"></i> 添加主食投票
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 投票详情模态框 -->
                        <div class="modal fade" id="vote-details-modal" tabindex="-1" aria-labelledby="vote-details-label" aria-hidden="true">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="vote-details-label">投票详情</h5>
                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <div class="modal-body">
                                        <div class="vote-details-header mb-4">
                                            <div class="d-flex align-items-center mb-3">
                                                <img src="https://via.placeholder.com/64" class="rounded me-3" alt="红烧肉">
                                                <div>
                                                    <h4>红烧肉</h4>
                                                    <span class="badge bg-info">特色小吃</span>
                                                </div>
                                            </div>
                                            
                                            <div class="row mt-3">
                                                <div class="col-md-6">
                                                    <table class="table table-sm">
                                                        <tr>
                                                            <th width="120">开始时间：</th>
                                                            <td>2023-05-01</td>
                                                        </tr>
                                                        <tr>
                                                            <th>结束时间：</th>
                                                            <td>2023-05-07</td>
                                                        </tr>
                                                        <tr>
                                                            <th>状态：</th>
                                                            <td><span class="badge bg-success">进行中</span></td>
                                                        </tr>
                                                    </table>
                                                </div>
                                                <div class="col-md-6">
                                                    <table class="table table-sm">
                                                        <tr>
                                                            <th width="120">已投票：</th>
                                                            <td>86人</td>
                                                        </tr>
                                                        <tr>
                                                            <th>总票数：</th>
                                                            <td>86票</td>
                                                        </tr>
                                                        <tr>
                                                            <th>参与率：</th>
                                                            <td>35.8%</td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="vote-details-result mb-4">
                                            <h5 class="mb-3">投票结果</h5>
                                            <div class="progress mb-3" style="height: 25px;">
                                                <div class="progress-bar bg-success" role="progressbar" style="width: 45%" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100">
                                                    <span class="fw-bold">喜欢 (45%)</span>
                                                </div>
                                                <div class="progress-bar bg-warning" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100">
                                                    <span class="fw-bold">一般 (30%)</span>
                                                </div>
                                                <div class="progress-bar bg-danger" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
                                                    <span class="fw-bold">不喜欢 (25%)</span>
                                                </div>
                                            </div>
                                            <div class="row text-center">
                                                <div class="col-md-4">
                                                    <div class="vote-stat-card p-3 border rounded">
                                                        <h6 class="text-success">喜欢</h6>
                                                        <h3>39人</h3>
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <div class="vote-stat-card p-3 border rounded">
                                                        <h6 class="text-warning">一般</h6>
                                                        <h3>26人</h3>
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <div class="vote-stat-card p-3 border rounded">
                                                        <h6 class="text-danger">不喜欢</h6>
                                                        <h3>21人</h3>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="vote-details-users">
                                            <h5>最近投票用户</h5>
                                            <div class="table-responsive">
                                                <table class="table">
                                                    <thead>
                                                        <tr>
                                                            <th>用户</th>
                                                            <th>部门</th>
                                                            <th>选项</th>
                                                            <th>投票时间</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <tr>
                                                            <td>张三</td>
                                                            <td>技术部</td>
                                                            <td><span class="badge bg-success">喜欢</span></td>
                                                            <td>2023-05-03 14:23</td>
                                                        </tr>
                                                        <tr>
                                                            <td>李四</td>
                                                            <td>市场部</td>
                                                            <td><span class="badge bg-warning">一般</span></td>
                                                            <td>2023-05-03 11:45</td>
                                                        </tr>
                                                        <tr>
                                                            <td>王五</td>
                                                            <td>人事部</td>
                                                            <td><span class="badge bg-success">喜欢</span></td>
                                                            <td>2023-05-03 10:32</td>
                                                        </tr>
                                                        <tr>
                                                            <td>赵六</td>
                                                            <td>财务部</td>
                                                            <td><span class="badge bg-danger">不喜欢</span></td>
                                                            <td>2023-05-03 09:17</td>
                                                        </tr>
                                                        <tr>
                                                            <td>孙七</td>
                                                            <td>技术部</td>
                                                            <td><span class="badge bg-success">喜欢</span></td>
                                                            <td>2023-05-02 16:45</td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                                        <button type="button" class="btn btn-primary"><i class="fas fa-file-export me-1"></i> 导出结果</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>

    <!-- 菜品编辑模态框 -->
    <div class="modal fade" id="edit-dish-modal" tabindex="-1" aria-labelledby="edit-dish-modal-label" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="edit-dish-modal-label">编辑菜品</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form id="edit-dish-form">
                        <div class="mb-3 text-center">
                            <div class="edit-image-preview mb-2">
                                <img src="https://via.placeholder.com/100" alt="菜品图片" class="img-thumbnail" style="width: 100px; height: 100px;">
                            </div>
                            <small class="text-muted">点击图片上传新图片</small>
                        </div>
                        <div class="mb-3">
                            <label for="edit-dish-name" class="form-label">菜品名称</label>
                            <input type="text" class="form-control" id="edit-dish-name" required>
                        </div>
                        <div class="mb-3">
                            <label for="edit-dish-type" class="form-label">菜品类型</label>
                            <select class="form-select" id="edit-dish-type" required>
                                <option value="特色小吃">特色小吃</option>
                                <option value="主食">主食</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="edit-dish-price" class="form-label">价格</label>
                            <input type="number" step="0.5" class="form-control" id="edit-dish-price" required>
                        </div>
                        <div class="mb-3">
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" id="edit-dish-votable" checked>
                                <label class="form-check-label" for="edit-dish-votable">可投票</label>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="save-dish-btn">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- Bootstrap和JavaScript -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="admin.js"></script>
    
    <!-- 添加用户编辑模态框 -->
    <div class="modal fade" id="edit-user-modal" tabindex="-1" aria-labelledby="edit-user-modal-label" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="edit-user-modal-label">编辑用户</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form id="edit-user-form">
                        <input type="hidden" id="edit-user-id">
                        <div class="mb-3">
                            <label for="edit-user-name" class="form-label">姓名</label>
                            <input type="text" class="form-control" id="edit-user-name" required>
                        </div>
                        <div class="mb-3">
                            <label for="edit-user-department" class="form-label">部门</label>
                            <select class="form-select" id="edit-user-department" required>
                                <option value="">请选择部门</option>
                                <option value="技术部">技术部</option>
                                <option value="市场部">市场部</option>
                                <option value="人事部">人事部</option>
                                <option value="财务部">财务部</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="edit-user-workid" class="form-label">工号</label>
                            <input type="text" class="form-control" id="edit-user-workid" required>
                        </div>
                        <div class="mb-3">
                            <label for="edit-user-balance" class="form-label">餐券余额</label>
                            <input type="number" step="0.5" class="form-control" id="edit-user-balance" required>
                        </div>
                        <div class="mb-3">
                            <label for="edit-user-role" class="form-label">角色</label>
                            <select class="form-select" id="edit-user-role" required>
                                <option value="普通用户">普通用户</option>
                                <option value="管理员">管理员</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="edit-user-status" class="form-label">状态</label>
                            <select class="form-select" id="edit-user-status" required>
                                <option value="正常">正常</option>
                                <option value="请假中">请假中</option>
                                <option value="离职">离职</option>
                            </select>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="save-user-btn">保存</button>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 动态增减菜品和商品的JavaScript代码 -->
    <script>
        // 等待DOM加载完成
        document.addEventListener('DOMContentLoaded', function() {
            // 菜品管理相关功能
            const dishTableBody = document.getElementById('dish-table-body');
            const addDishRowBtn = document.getElementById('add-dish-row');
            const removeDishRowBtn = document.getElementById('remove-dish-row');
            
            if (addDishRowBtn && removeDishRowBtn) {
                // 添加新菜品行
                addDishRowBtn.addEventListener('click', function() {
                    // 创建新的空白菜品行
                    const newRow = document.createElement('tr');
                    newRow.className = 'new-dish-row';
                    newRow.innerHTML = `
                        <td>
                            <div class="upload-placeholder">
                                <i class="fas fa-image"></i>
                            </div>
                        </td>
                        <td><input type="text" class="form-control form-control-sm" placeholder="菜品名称"></td>
                        <td>
                            <select class="form-select form-select-sm">
                                <option value="snack">特色小吃</option>
                                <option value="staple">主食</option>
                            </select>
                        </td>
                        <td>
                            <select class="form-select form-select-sm">
                                <option value="meat">肉类</option>
                                <option value="vegetable">蔬菜</option>
                                <option value="seafood">海鲜</option>
                                <option value="dessert">甜点</option>
                                <option value="rice">米饭类</option>
                                <option value="noodle">面食类</option>
                                <option value="other">其他</option>
                            </select>
                        </td>
                        <td><input type="number" class="form-control form-control-sm" min="0" step="0.5" placeholder="价格"></td>
                        <td>
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" checked>
                            </div>
                        </td>
                        <td>
                            <div class="progress" style="height: 6px; width: 80px;">
                                <div class="progress-bar bg-secondary" role="progressbar" style="width: 0%"></div>
                            </div>
                        </td>
                        <td>
                            <button class="btn btn-sm btn-success save-dish-btn"><i class="fas fa-check"></i></button>
                            <button class="btn btn-sm btn-secondary cancel-dish-btn"><i class="fas fa-times"></i></button>
                        </td>
                    `;
                    
                    // 将新行插入到操作行之前
                    const actionRow = document.getElementById('dish-action-row');
                    dishTableBody.insertBefore(newRow, actionRow);
                    
                    // 绑定取消按钮事件
                    newRow.querySelector('.cancel-dish-btn').addEventListener('click', function() {
                        newRow.remove();
                    });
                    
                    // 绑定保存按钮事件
                    newRow.querySelector('.save-dish-btn').addEventListener('click', function() {
                        // 这里应该有实际的保存逻辑，保存成功后再更新行
                        const name = newRow.querySelector('input[placeholder="菜品名称"]').value;
                        const type = newRow.querySelector('select').value;
                        const typeText = type === 'snack' ? '特色小吃' : '主食';
                        const typeClass = type === 'snack' ? 'bg-info' : 'bg-primary';
                        const category = newRow.querySelectorAll('select')[1].value;
                        const categoryOptions = {
                            'meat': '肉类',
                            'vegetable': '蔬菜',
                            'seafood': '海鲜',
                            'dessert': '甜点',
                            'rice': '米饭类',
                            'noodle': '面食类',
                            'other': '其他'
                        };
                        const price = newRow.querySelector('input[type="number"]').value || '0';
                        const isVotable = newRow.querySelector('input[type="checkbox"]').checked;
                        
                        // 更新行内容为保存后的状态
                        newRow.innerHTML = `
                            <td>
                                <img src="https://via.placeholder.com/40" alt="${name}" class="img-thumbnail">
                            </td>
                            <td>${name}</td>
                            <td><span class="badge ${typeClass}">${typeText}</span></td>
                            <td>${categoryOptions[category] || '其他'}</td>
                            <td>¥${price}</td>
                            <td><span class="badge ${isVotable ? 'bg-success' : 'bg-secondary'}">${isVotable ? '可投票' : '不可投票'}</span></td>
                            <td>
                                <div class="progress" style="height: 6px; width: 80px;">
                                    <div class="progress-bar bg-danger" role="progressbar" style="width: 0%"></div>
                                </div>
                            </td>
                            <td>
                                <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                            </td>
                        `;
                        
                        // 移除新行样式
                        newRow.classList.remove('new-dish-row');
                    });
                });
                
                // 移除菜品行
                removeDishRowBtn.addEventListener('click', function() {
                    // 获取所有普通菜品行（除了操作行和新添加行）
                    const dishRows = Array.from(dishTableBody.querySelectorAll('tr:not(#dish-action-row):not(.new-dish-row)'));
                    if (dishRows.length > 0) {
                        // 移除最后一个菜品行
                        dishRows[dishRows.length - 1].remove();
                    } else {
                        alert('没有可移除的菜品行');
                    }
                });
            }
            
            // 商品管理相关功能
            const productTableBody = document.getElementById('product-table-body');
            const addProductRowBtn = document.getElementById('add-product-row');
            const removeProductRowBtn = document.getElementById('remove-product-row');
            
            if (addProductRowBtn && removeProductRowBtn) {
                // 添加新商品行
                addProductRowBtn.addEventListener('click', function() {
                    // 创建新的空白商品行
                    const newRow = document.createElement('tr');
                    newRow.className = 'new-product-row';
                    newRow.innerHTML = `
                        <td>
                            <div class="upload-placeholder">
                                <i class="fas fa-image"></i>
                            </div>
                        </td>
                        <td><input type="text" class="form-control form-control-sm" placeholder="商品名称"></td>
                        <td>
                            <select class="form-select form-select-sm">
                                <option value="physical">实物商品</option>
                                <option value="food">餐厅菜品</option>
                            </select>
                        </td>
                        <td>
                            <select class="form-select form-select-sm">
                                <option value="staple">主食</option>
                                <option value="meat">肉类</option>
                                <option value="vegetable">蔬菜</option>
                                <option value="snack">特色小吃</option>
                                <option value="grocery">日用品</option>
                                <option value="oil">食用油</option>
                                <option value="rice">大米</option>
                                <option value="other">其他</option>
                            </select>
                        </td>
                        <td><input type="number" class="form-control form-control-sm" min="0" step="0.5" placeholder="价格"></td>
                        <td><input type="number" class="form-control form-control-sm" min="0" placeholder="库存"></td>
                        <td>
                            <div class="form-check form-switch">
                                <input class="form-check-input" type="checkbox" checked>
                            </div>
                        </td>
                        <td>
                            <button class="btn btn-sm btn-success save-product-btn"><i class="fas fa-check"></i></button>
                            <button class="btn btn-sm btn-secondary cancel-product-btn"><i class="fas fa-times"></i></button>
                        </td>
                    `;
                    
                    // 将新行插入到操作行之前
                    const actionRow = document.getElementById('product-action-row');
                    productTableBody.insertBefore(newRow, actionRow);
                    
                    // 绑定取消按钮事件
                    newRow.querySelector('.cancel-product-btn').addEventListener('click', function() {
                        newRow.remove();
                    });
                    
                    // 绑定保存按钮事件
                    newRow.querySelector('.save-product-btn').addEventListener('click', function() {
                        // 这里应该有实际的保存逻辑，保存成功后再更新行
                        const name = newRow.querySelector('input[placeholder="商品名称"]').value;
                        const type = newRow.querySelector('select').value;
                        const typeText = type === 'physical' ? '实物商品' : '餐厅菜品';
                        const typeClass = type === 'physical' ? 'bg-primary' : 'bg-info';
                        const category = newRow.querySelectorAll('select')[1].value;
                        const categoryOptions = {
                            'staple': '主食',
                            'meat': '肉类',
                            'vegetable': '蔬菜',
                            'snack': '特色小吃',
                            'grocery': '日用品',
                            'oil': '食用油',
                            'rice': '大米',
                            'other': '其他'
                        };
                        const price = newRow.querySelector('input[placeholder="价格"]').value || '0';
                        const stock = newRow.querySelector('input[placeholder="库存"]').value || '0';
                        const isActive = newRow.querySelector('input[type="checkbox"]').checked;
                        
                        // 餐厅菜品没有库存
                        const stockDisplay = type === 'food' ? '--' : stock;
                        
                        // 更新行内容为保存后的状态
                        newRow.innerHTML = `
                            <td>
                                <img src="https://via.placeholder.com/40" alt="${name}" class="img-thumbnail">
                            </td>
                            <td>${name}</td>
                            <td><span class="badge ${typeClass}">${typeText}</span></td>
                            <td>${categoryOptions[category] || '其他'}</td>
                            <td>${price}</td>
                            <td>${stockDisplay}</td>
                            <td><span class="badge ${isActive ? 'bg-success' : 'bg-warning'}">${isActive ? '已上架' : '待上架'}</span></td>
                            <td>
                                <button class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></button>
                                <button class="btn btn-sm btn-outline-danger"><i class="fas fa-trash-alt"></i></button>
                            </td>
                        `;
                        
                        // 移除新行样式
                        newRow.classList.remove('new-product-row');
                    });
                });
                
                // 移除商品行
                removeProductRowBtn.addEventListener('click', function() {
                    // 获取所有普通商品行（除了操作行和新添加行）
                    const productRows = Array.from(productTableBody.querySelectorAll('tr:not(#product-action-row):not(.new-product-row)'));
                    if (productRows.length > 0) {
                        // 移除最后一个商品行
                        productRows[productRows.length - 1].remove();
                    } else {
                        alert('没有可移除的商品行');
                    }
                });
            }
        });
    </script>
</body>
</html> 